<template>
	<view class="bg-white">
		<u-navbar  title="报名记录" :autoBack="true" safeAreaInsetTop fixed placeholder />
		<view>
			<uni-card :cover="cover" :title="item.courseName" v-for="(item,index) in list" :key="index" 
				:extra="item.studentName" padding="0">
				<u-cell-group>
					<u-cell  center 
						:is-link="true" index="index" @click="showDetail(item.id)" :arrow="true">
						<view slot="label" style="font-size: 80%;">
							课程有效期：
							{{parseTime(item.startDate,'{y}-{m}-{d}')}} 
							~ 
							{{parseTime(item.expireDate,'{y}-{m}-{d}')}}
						</view>
						<view slot="value">￥{{item.amount}}</view>
					</u-cell>
				</u-cell-group>
			</uni-card>
				<view class="u-padding-30 bg-white" v-if="list.length == 0" >
					<u-empty mode="list" text="暂无报单信息"></u-empty>
				</view>
		</view>
	</view>
</template>
<script>
	import paginateMix from "@/mixins/paginateMixins.js"
	import request from '@/utils/request'
	import { parseTime} from '@/utils/zhanpeng.js'
	
	export default {
		mixins: [paginateMix],
		data() {
			return {
				checked: false,
				list: [],
			}
		},
		onLoad() {
			this.handleReq()
		},
		methods: {
			parseTime(time,pattern) {
			  return parseTime(time,pattern)
			},
			handleReq() {
				request({url:'/edu/student-course/page',data:{page: this.pageData.page}}).then(res => {
					if(!this.$common.handleResponseMsg(res)) return;
					this.list = this.list.concat(res.data.list)
					this.pageData.page = parseInt(res.page);
					this.pageData.lastPage = parseInt(res.pageCount);
				});
			},
			showDetail(id) {
				uni.navigateTo({
					url: `/pages/contract/detail?contractId=${id}`
				});
			},
			clickRight() {
				this.list = [];
				this.pageData.page = 1
				this.handleReq()
			},
			clickLeft() {
				uni.switchTab({
					url: '/pages/index/index'
				});
			}
		}
	}
</script>
<style lang="scss" scoped>
</style>
